/**
 * Syg at 17.03.2013 for Pikovskii
 */
package intf;

import geometry.IXYLine;

import java.util.ListIterator;

import ru.ts.gisutils.geometry.IXY;

/**
 * @author Syg
 * 
 * Polyline interface
 *
 */
public interface IPLine
{
	  /**
	   * Number of separate points in this object
	   * @return int with number of lines in the object
	   */
	  int size();

	  /**
	   * Number of separate lines in this object
	   * @return int with number of lines in the object
	   */
	  int lineCount();
	  
	  /**
	   * Is line enclosed (true) or not (false)
	   * @return
	   */
	  boolean isEnclosed();
	  
	  void setEnclosed( boolean enclosed);

	  /**
	   * Gets current line at designated index
	   * @param index int index of line to get
	   * @return {@link ILine} found at designated index
	   */
	  ILine line(int index) throws ArrayIndexOutOfBoundsException;

	  /**
	   * Returns iterator for all lines
	   * @return {@link ListIterator<ILine>} for lines in the internal array
	   */
	  ListIterator<ILine> getIterator();


	  /**
	   * Splits designated line with a point
	   * @param index int with an index of line to insert new point into it
	   * @param pnt {@link IPoint} to split line
	   */
	  void split( int index, IPoint pnt);

	  /**
	   * Insert before line is synonym for split (index-1, pnt), but for 1st line in this polyline it allow to create
	   * new line before start one
	   * @param index index to insert point, if 0, point creates new line at first position
	   * @param point {@link IPoint} point
	   */
	  void insertBefore( int index, IPoint point );

	  /**
	   * Appends point to the end of current polyline, creating new trailing line, analogous to split( index+1, pnt)
	   * @param point {@link IPoint} point to append to
	   */
	  void append( IPoint point);
	  
	  /**
	   * Returns <b>{@code true}</b> if point is IN polygon else {@code false}
	   * @param pnt
	   * @return
	   */
	  boolean isInterior(IPoint pnt);

}
